<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/BSP/dev_uart.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_4ca18d753a70f6eada20fde478bd3fc8.html">BSP</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">dev_uart.c</div></div>
</div><!--header-->
<div class="contents">
<a href="dev__uart_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#include &quot;<a class="code" href="dev__uart_8h.html">dev_uart.h</a>&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="preprocessor">#include &quot;<a class="code" href="version_8h.html">version.h</a>&quot;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">   27</a></span><span class="preprocessor">#define DEBUG_UART_X              UART0</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#ae74f99a4e9fcb1f759bef9a73b0bf091">   30</a></span><span class="preprocessor">#define DEBUG_UART_BAUD           57600</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="preprocessor">#if (SWM34S_LCM_PCBV == SWM34SCE_PIN48_A2)</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span><span class="comment">/* 接按键输入检测, 用作 SWD 端口切换 UART 与 SWD 功能 */</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#afdd0a75ca080e0e09d20841e7d1d0ea0">   34</a></span><span class="preprocessor">#define KEY_INPUT_GPIO        GPIOD</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#ae95dbd4884384af5f7a5f705586b21ad">   35</a></span><span class="preprocessor">#define KEY_INPUT_PIN         PIN2</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#ac12e742cf904e08383401dd68a88001b">   43</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#ac12e742cf904e08383401dd68a88001b">uart_port_switch</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>{</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    <span class="keyword">static</span> uint8_t init_flag = 0;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    <span class="keywordflow">if</span> (init_flag == 0) <span class="comment">/* 仅初次上电检测一次 */</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>        <span class="comment">/* SWM341 系列 GPIO A15/B2/B3/B4/B5/C0/C1/C2 提供了 IO 滤波功能, 且可配置滤波 IO、滤波时钟、滤波窗口时间等 */</span></div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>        GPIO_Init(<a class="code hl_define" href="dev__uart_8c.html#afdd0a75ca080e0e09d20841e7d1d0ea0">KEY_INPUT_GPIO</a>, <a class="code hl_define" href="dev__uart_8c.html#ae95dbd4884384af5f7a5f705586b21ad">KEY_INPUT_PIN</a>, 0, 0, 1, 0); <span class="comment">/* 输入 &amp; 内部下拉 */</span></div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>        uint32_t valid = 0;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>        uint32_t window_time = 666; <span class="comment">/* 对上电启动影响较小 */</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>        <span class="keywordflow">for</span> (uint32_t time = 0; time &lt; window_time; ++time)</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>        {</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>            valid += GPIO_GetBit(<a class="code hl_define" href="dev__uart_8c.html#afdd0a75ca080e0e09d20841e7d1d0ea0">KEY_INPUT_GPIO</a>, <a class="code hl_define" href="dev__uart_8c.html#ae95dbd4884384af5f7a5f705586b21ad">KEY_INPUT_PIN</a>); <span class="comment">/* 高电平有效 */</span></div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>            <span class="keywordflow">for</span> (uint32_t i = 0; i &lt; 88; ++i) __NOP();  <span class="comment">/* 简单去抖 */</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>        }</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>        <span class="keywordflow">if</span> ( valid &gt;= (window_time &gt;&gt; 1) ) <span class="comment">/* 大于一半的窗口时间视为有效 */</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>        {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>            init_flag = 1;</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>        }</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>        <span class="keywordflow">else</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>        {</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>            init_flag = 2;</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>        }</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>    }</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    <span class="keywordflow">if</span> (1 == init_flag)</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    {</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>        <span class="comment">/* SWD 端口切换为 GPIO 或 其它功能时必须加上这句, 未在固件库中开放给用户, 避免用户配置端口错误而导致无法下载 */</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>        *((<span class="keyword">volatile</span> uint32_t *)0x40000190) = 0;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>        PORT_Init(PORTB, PIN12, PORTB_PIN12_UART0_RX, 1); <span class="comment">/* GPIOB.12 配置为 UART0 输入引脚 */</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        PORT_Init(PORTB, PIN14, PORTB_PIN14_UART0_TX, 0); <span class="comment">/* GPIOB.14 配置为 UART0 输出引脚 */</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    }</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (2 == init_flag)</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>    {</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>        <span class="comment">/* 如要恢复 SWD 端口功能必须加上这句, 未在固件库中开放给用户(重新上电后, SWD 端口总会自动恢复为 SWD 功能) */</span></div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>        *((<span class="keyword">volatile</span> uint32_t *)0x40000190) = 1;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>        PORT_Init(PORTB, PIN14, PORTB_PIN14_SWDIO, 1);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>        PORT_Init(PORTB, PIN12, PORTB_PIN12_SWDCK, 1);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>    }</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>}</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">   90</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">uart_debug_port_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>{</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span><span class="preprocessor">#if (SWM34S_LCM_PCBV == SWM34SCE_PIN48_A2) </span><span class="comment">/* D2 接高复位上电时, 将 SWD/SWC 端口复用为 调试串口打印 &lt;端口十分紧张&gt; */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>    <a class="code hl_function" href="dev__uart_8c.html#ac12e742cf904e08383401dd68a88001b">uart_port_switch</a>();</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>    PORT_Init(PORTM, PIN0, PORTM_PIN0_UART0_RX, 1); <span class="comment">/* GPIOM.0 配置为 UART0 输入引脚 */</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>    PORT_Init(PORTM, PIN1, PORTM_PIN1_UART0_TX, 0); <span class="comment">/* GPIOM.1 配置为 UART0 输出引脚 */</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>}</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#afd092ef1d390fe16bc90e101bbbca1d8">  103</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#afd092ef1d390fe16bc90e101bbbca1d8">uart_debug_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>{</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span>    <a class="code hl_function" href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">uart_debug_port_init</a>();</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>    UART_InitStructure UART_initStruct;</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>    UART_initStruct.Baudrate = <a class="code hl_define" href="dev__uart_8c.html#ae74f99a4e9fcb1f759bef9a73b0bf091">DEBUG_UART_BAUD</a>;</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    UART_initStruct.DataBits = UART_DATA_8BIT;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>    UART_initStruct.Parity = UART_PARITY_NONE;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span>    UART_initStruct.StopBits = UART_STOP_1BIT;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span> </div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>    UART_initStruct.RXThreshold = 3;</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>    UART_initStruct.RXThresholdIEn = 0;</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>    UART_initStruct.TXThreshold = 3;</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>    UART_initStruct.TXThresholdIEn = 0;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span>    UART_initStruct.TimeoutTime = 10;</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>    UART_initStruct.TimeoutIEn = 0;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>    UART_Init(<a class="code hl_define" href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">DEBUG_UART_X</a>, &amp;UART_initStruct);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span>    UART_Open(<a class="code hl_define" href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">DEBUG_UART_X</a>);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>}</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span> </div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a21296d9c26b359559c9c6c65a7cb1151">  132</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#a21296d9c26b359559c9c6c65a7cb1151">uart_send_msg</a>(UART_TypeDef *uart_x, <span class="keyword">const</span> uint8_t *src_buf, <span class="keyword">const</span> uint32_t num_bytes)</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>{</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>    <span class="keyword">const</span> uint8_t *ptr = src_buf;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>    <span class="keywordflow">for</span> (uint32_t i = 0; i &lt; num_bytes; i++)</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>    {</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>        <span class="keywordflow">if</span> (UART_IsTXFIFOFull(uart_x) == 0)</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>        {</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>            UART_WriteByte(uart_x, *ptr++);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>        }</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>        <span class="keywordflow">while</span> (UART_IsTXBusy(uart_x))</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>            ; <span class="comment">/* 忙查询 */</span></div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span>    }</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>}</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span><span class="preprocessor">#if !defined(__MICROLIB) </span><span class="comment">/* printf(...) 的两种重定向实现: 标准C库      MicroLIB C库 */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a89bad4750e10db3e5de90c026aaa01ef">  151</a></span><a class="code hl_function" href="dev__uart_8c.html#a89bad4750e10db3e5de90c026aaa01ef">__asm</a>(<span class="stringliteral">&quot;.global __use_no_semihosting\n\t&quot;</span>);</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a123aeac44456d49a7687b2111946f357">  152</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#a123aeac44456d49a7687b2111946f357">_sys_exit</a>(<span class="keywordtype">int</span> x)</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>{</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>    x = x;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span>}</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span> </div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span><span class="comment">/* __use_no_semihosting was requested, but _ttywrch was */</span></div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a1647e9479b4be5731d79c81af76826c5">  158</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="dev__uart_8c.html#a1647e9479b4be5731d79c81af76826c5">_ttywrch</a>(<span class="keywordtype">int</span> <a class="code hl_variable" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a>)</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span>{</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span>    <a class="code hl_variable" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a> = <a class="code hl_variable" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a>;</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span>}</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span> </div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span><span class="comment">/*</span></div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span><span class="comment">struct __FILE</span></div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span><span class="comment">{</span></div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span><span class="comment">  int handle;</span></div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span><span class="comment">};*/</span></div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span> </div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#ac1f65ebf7d6f28fb49530ee0095306cb">  169</a></span>FILE <a class="code hl_variable" href="dev__uart_8c.html#ac1f65ebf7d6f28fb49530ee0095306cb">__stdout</a>;</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span> </div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span><span class="preprocessor">#endif </span><span class="comment">/* !defined(__MICROLIB) */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span> </div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span><span class="preprocessor">#if defined(__GNUC__) &amp;&amp; !defined(__clang__)</span></div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span><span class="preprocessor">#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)</span></div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#ac040eb6679fed6e591776425aa7abd9d">  176</a></span><span class="preprocessor">#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)</span></div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span><span class="preprocessor">#endif </span><span class="comment">/* defined ( __GNUC__ ) &amp;&amp; !defined (__clang__)  */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span> </div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a6b71e3c5cd86d6941c8f4a8beb1b354f">  179</a></span><a class="code hl_define" href="dev__uart_8c.html#ac040eb6679fed6e591776425aa7abd9d">PUTCHAR_PROTOTYPE</a> <span class="comment">/* 实现串口发送一个字节数据的函数 */</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span>{</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span>    UART_WriteByte(<a class="code hl_define" href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">DEBUG_UART_X</a>, <a class="code hl_variable" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a>);</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span> </div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a94d759835044f71c25d88eb4bd877d14">  183</a></span>    <span class="keywordflow">while</span> (UART_IsTXBusy(<a class="code hl_define" href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">DEBUG_UART_X</a>))</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span>        ;</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span> </div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"><a class="line" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">  186</a></span>    <span class="keywordflow">return</span> <a class="code hl_variable" href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a>;</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>}</div>
<div class="ttc" id="adev__uart_8c_html_a0523c05685d59544dca911cb6a3db77d"><div class="ttname"><a href="dev__uart_8c.html#a0523c05685d59544dca911cb6a3db77d">ch</a></div><div class="ttdeci">return ch</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00186">dev_uart.c:186</a></div></div>
<div class="ttc" id="adev__uart_8c_html_a123aeac44456d49a7687b2111946f357"><div class="ttname"><a href="dev__uart_8c.html#a123aeac44456d49a7687b2111946f357">_sys_exit</a></div><div class="ttdeci">void _sys_exit(int x)</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00152">dev_uart.c:152</a></div></div>
<div class="ttc" id="adev__uart_8c_html_a1647e9479b4be5731d79c81af76826c5"><div class="ttname"><a href="dev__uart_8c.html#a1647e9479b4be5731d79c81af76826c5">_ttywrch</a></div><div class="ttdeci">void _ttywrch(int ch)</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00158">dev_uart.c:158</a></div></div>
<div class="ttc" id="adev__uart_8c_html_a21296d9c26b359559c9c6c65a7cb1151"><div class="ttname"><a href="dev__uart_8c.html#a21296d9c26b359559c9c6c65a7cb1151">uart_send_msg</a></div><div class="ttdeci">void uart_send_msg(UART_TypeDef *uart_x, const uint8_t *src_buf, const uint32_t num_bytes)</div><div class="ttdoc">串口发送数据</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00132">dev_uart.c:132</a></div></div>
<div class="ttc" id="adev__uart_8c_html_a33047df92b9014ff5cb2536417f22ed3"><div class="ttname"><a href="dev__uart_8c.html#a33047df92b9014ff5cb2536417f22ed3">DEBUG_UART_X</a></div><div class="ttdeci">#define DEBUG_UART_X</div><div class="ttdoc">用作调试日志打印的串口号</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00027">dev_uart.c:27</a></div></div>
<div class="ttc" id="adev__uart_8c_html_a89bad4750e10db3e5de90c026aaa01ef"><div class="ttname"><a href="dev__uart_8c.html#a89bad4750e10db3e5de90c026aaa01ef">__asm</a></div><div class="ttdeci">__asm(&quot;.global __use_no_semihosting\n\t&quot;)</div><div class="ttdoc">不使用 MicroLIB 时避免使用半主机模式</div></div>
<div class="ttc" id="adev__uart_8c_html_aadbe4996756dcc6199bc9ec2e4969993"><div class="ttname"><a href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">uart_debug_port_init</a></div><div class="ttdeci">void uart_debug_port_init(void)</div><div class="ttdoc">配置串口打印调试日志的端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00090">dev_uart.c:90</a></div></div>
<div class="ttc" id="adev__uart_8c_html_ac040eb6679fed6e591776425aa7abd9d"><div class="ttname"><a href="dev__uart_8c.html#ac040eb6679fed6e591776425aa7abd9d">PUTCHAR_PROTOTYPE</a></div><div class="ttdeci">#define PUTCHAR_PROTOTYPE</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00176">dev_uart.c:176</a></div></div>
<div class="ttc" id="adev__uart_8c_html_ac12e742cf904e08383401dd68a88001b"><div class="ttname"><a href="dev__uart_8c.html#ac12e742cf904e08383401dd68a88001b">uart_port_switch</a></div><div class="ttdeci">static void uart_port_switch(void)</div><div class="ttdoc">串口（SWD）端口功能切换</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00043">dev_uart.c:43</a></div></div>
<div class="ttc" id="adev__uart_8c_html_ac1f65ebf7d6f28fb49530ee0095306cb"><div class="ttname"><a href="dev__uart_8c.html#ac1f65ebf7d6f28fb49530ee0095306cb">__stdout</a></div><div class="ttdeci">FILE __stdout</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00169">dev_uart.c:169</a></div></div>
<div class="ttc" id="adev__uart_8c_html_ae74f99a4e9fcb1f759bef9a73b0bf091"><div class="ttname"><a href="dev__uart_8c.html#ae74f99a4e9fcb1f759bef9a73b0bf091">DEBUG_UART_BAUD</a></div><div class="ttdeci">#define DEBUG_UART_BAUD</div><div class="ttdoc">用作调试日志打印的串口波特率（data-8, stop-1, no parity）</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00030">dev_uart.c:30</a></div></div>
<div class="ttc" id="adev__uart_8c_html_ae95dbd4884384af5f7a5f705586b21ad"><div class="ttname"><a href="dev__uart_8c.html#ae95dbd4884384af5f7a5f705586b21ad">KEY_INPUT_PIN</a></div><div class="ttdeci">#define KEY_INPUT_PIN</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00035">dev_uart.c:35</a></div></div>
<div class="ttc" id="adev__uart_8c_html_afd092ef1d390fe16bc90e101bbbca1d8"><div class="ttname"><a href="dev__uart_8c.html#afd092ef1d390fe16bc90e101bbbca1d8">uart_debug_init</a></div><div class="ttdeci">void uart_debug_init(void)</div><div class="ttdoc">初始化用作打印调试日志的串口</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00103">dev_uart.c:103</a></div></div>
<div class="ttc" id="adev__uart_8c_html_afdd0a75ca080e0e09d20841e7d1d0ea0"><div class="ttname"><a href="dev__uart_8c.html#afdd0a75ca080e0e09d20841e7d1d0ea0">KEY_INPUT_GPIO</a></div><div class="ttdeci">#define KEY_INPUT_GPIO</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00034">dev_uart.c:34</a></div></div>
<div class="ttc" id="adev__uart_8h_html"><div class="ttname"><a href="dev__uart_8h.html">dev_uart.h</a></div><div class="ttdoc">调试日志串口打印</div></div>
<div class="ttc" id="aversion_8h_html"><div class="ttname"><a href="version_8h.html">version.h</a></div><div class="ttdoc">版本/目标控制</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
